package com.kedacom.freedomLabel.initdata.dao;


import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import com.kedacom.freedomLabel.initdata.bean.Goods;
import com.kedacom.freedomLabel.model.db.dao.IDao;

import java.util.List;

@Dao
public interface GoodsDao extends IDao<Goods> {


    @Override
    @Query("SELECT COUNT(0) FROM Goods")
    int count();

    @Override
    @Update
    void update(Goods data);

    @Override
    @Insert(onConflict = OnConflictStrategy.FAIL)
    long save(Goods data);

    @Override
    @Insert(onConflict = OnConflictStrategy.FAIL)
    long[] save(List<Goods> data);

    @Override
    @Query("SELECT * FROM Goods ORDER BY gridId DESC")
    List<Goods> get();

    @Override
    @Query("SELECT * FROM Goods WHERE gridName like '%' || :param || '%' ")
    List<Goods> get(String param);

    @Override
    @Query("SELECT * FROM Goods WHERE gridName=:param1 and gridName LIKE :param2")
    List<Goods> get(String param1, String param2);

    @Override
    @Delete
    void delete(Goods data);

    @Override
    @Query("DELETE FROM Goods")
    void delete();

    @Override
    @Query("DELETE FROM Goods WHERE gridName=:param ")
    void delete(String param);


    //    @Query("SELECT * FROM Goods")
//    List<Goods> getAllGoods();
//
//    @Query("SELECT * FROM Goods WHERE gridId=:gridId")
//    Goods getGoodsOne(String gridId);
//
//    @Insert
//    void insert(Goods... goods);
//
//    @Insert
//    void insert(List<Goods> goods);
//
//    @Update
//    void update(Goods... goods);
//
//    @Update
//    void update(List<Goods> goodsList);
//
//    @Delete
//    void delete(Goods... goods);
//
//    @Delete
//    void delete(List<Goods> goodsList);


}
